package com.stein.entity;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.stein.entity.Student;
import com.stein.entity.Score;
import com.stein.entity.Subject;

import com.stein.entity.StudentDao;
import com.stein.entity.ScoreDao;
import com.stein.entity.SubjectDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig studentDaoConfig;
    private final DaoConfig scoreDaoConfig;
    private final DaoConfig subjectDaoConfig;

    private final StudentDao studentDao;
    private final ScoreDao scoreDao;
    private final SubjectDao subjectDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        studentDaoConfig = daoConfigMap.get(StudentDao.class).clone();
        studentDaoConfig.initIdentityScope(type);

        scoreDaoConfig = daoConfigMap.get(ScoreDao.class).clone();
        scoreDaoConfig.initIdentityScope(type);

        subjectDaoConfig = daoConfigMap.get(SubjectDao.class).clone();
        subjectDaoConfig.initIdentityScope(type);

        studentDao = new StudentDao(studentDaoConfig, this);
        scoreDao = new ScoreDao(scoreDaoConfig, this);
        subjectDao = new SubjectDao(subjectDaoConfig, this);

        registerDao(Student.class, studentDao);
        registerDao(Score.class, scoreDao);
        registerDao(Subject.class, subjectDao);
    }
    
    public void clear() {
        studentDaoConfig.getIdentityScope().clear();
        scoreDaoConfig.getIdentityScope().clear();
        subjectDaoConfig.getIdentityScope().clear();
    }

    public StudentDao getStudentDao() {
        return studentDao;
    }

    public ScoreDao getScoreDao() {
        return scoreDao;
    }

    public SubjectDao getSubjectDao() {
        return subjectDao;
    }

}
